package lesson19;

public class Page 
{
	private String title;
	private String text = "";
	
	Page(String title)
	{
		if (title == null)
		{
			System.out.println("Wrong title! Please try again!");
		}
		else
		{
			this.title = title;
		}
		
	}
	
	void addText(final String addedText)
	{
		if (addedText == null)
		{
			System.out.println("Wrong text! Please try again!");
		}
		else
		{
			this.text += addedText + "\n";
		}
	}
	
	void deleteText()
	{
		this.text = "";
	}
	
	String getText()
	{
		return this.title + "\n" + this.text;
	}
	
	@Override
	public boolean equals(Object obj) 
	{
		if (obj != null && obj instanceof Page)
		{
			return ((Page)obj).title.equals(this.title);
		}
		else
		{
			return false;
		}
	}
}
